/**
 * 
 */
package com.huarui.component.service;

import java.util.List;
import java.util.Map;

import org.ewaf.framework.model.PagingInfo;
import org.ewaf.framework.model.PagingSummary;

import com.huarui.company.dao.ICompanyDao;

/**
 * @author peng.sunp
 * 
 */
public class LookupCompanyService {

	private ICompanyDao companyDao;

	public List<Map<String, Object>> queryCompanys(String PYCodePrefix,
			int pageNo, int pageSize) {
		PagingSummary summary = new PagingSummary();
		summary.setStart((pageNo-1)*pageSize);
		summary.setLimit(pageSize);
		List<Map<String, Object>> list = companyDao.getCompanysByPYCodePrefix(
				PYCodePrefix, summary);
		return list;
	}

	public void queryCompanys(PagingInfo<String, Map<String, Object>> paginInfo) {
		List<Map<String, Object>> items = companyDao.getCompanysByPYCodePrefix(
				paginInfo.getCondition(), paginInfo.getSummary());
		int total = companyDao.getCompanysCountByPYCodePrefix(paginInfo
				.getCondition());
		paginInfo.setItems(items);
		paginInfo.setTotal(total);
	}

	public void setCompanyDao(ICompanyDao companyDao) {
		this.companyDao = companyDao;
	}
}
